<!DOCTYPE html>
<html lang="en">
<head>
    {include file="public/meta" /}
    {include file="public/link" /}
</head>
<body data-type="index" class="theme-white">
<div class="am-g tpl-g">
    {include file="public/header" /}
    {include file="public/left" /}
    {include file="public/content_top" /}
    <ol class="am-breadcrumb">
        <li><a href="../home/index.html" class="am-icon-home">首页</a></li>
        <li><a href="#">申请管理</a></li>
        <li class="am-active">提现申请</li>
    </ol>
    <div class="widget am-cf">
        <div class="am-form-inline" role="form">
            <span>日期范围：</span>
            <div class="am-form-group ">
                <input type="text" class="am-form-field am-input-sm" name="start" placeholder="请选择起始日期"
                       data-am-datepicker onfocus="this.blur()" value="{$arr.start_query}"/>
            </div>
            <div class="am-form-group ">
                <input type="text" class="am-form-field am-input-sm" name="end" placeholder="请选择结束日期" data-am-datepicker
                       onfocus="this.blur()" value="{$arr.end_query}"/>
            </div>
            <div class="am-form-group ">
                <input type="text" id="name" class="am-form-field am-input-sm" placeholder="请输入手机号"
                       value="{$arr.name}"/>
            </div>
            <button type="button" class="am-btn am-btn-primary am-btn-sm" onclick="info_query()">查询</button>
            <button type="button" class="am-btn am-btn-warning am-btn-sm" onclick="clear_query()">清除查询</button>
        </div>
        <hr data-am-widget="divider" class="am-divider am-divider-default"/>
        <div class="widget-body widget-body-lg am-fr">
            <div class="am-scrollable-horizontal">
                <table class="{$table}">
                    <thead>
                    <tr>
                        <th>选择</th>
                        <th>申请用户</th>
                        <th>姓名</th>
                        <th>申请金额</th>
                        <th>手续费</th>
                        <th>到账金额</th>
                        <th>收款账户信息</th>
                        <th>申请时间</th>
                        <th>处理状态</th>
                        <th>备注</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="list">
                    {volist name="list" id="vo" empty="$empty"}
                    <tr>
                        <td><input id="rptList_chkId_3" type="checkbox" name="rptList$ctl04$chkId"></td>
                        <td>{$vo['user']['phone']}</td>
                        <td>{$vo['user']['real_name']}</td>
                        <td>{$vo.number}</td>
                        <td>{$vo.fee}</td>
                        <td>{$vo.number-$vo.fee}</td>
                        <td>{$vo.card}</td>
                        <td>{$vo.time|date="Y-m-d H:i:s",###}</td>
                        {if condition="$vo.status eq 0"}
                        <td>未处理</td>
                        {elseif/ condition="$vo.status eq 1"}
                        <td>已处理</td>
                        {elseif/ condition="$vo.status eq 2"}
                        <td>已拒绝</td>
                        {/if}
                        <td>{$vo.refer_to}</td>
                        <td>
                            {if condition="$vo.status neq 0"}
                            <a href="#" class="am-btn am-btn-warning am-btn-xs">已处理</a>
                            {else /}
                            <a href="javascript:" onClick="pass(this, {$vo.id})"
                               class="am-btn am-btn-success am-btn-xs">通过</a>
                            <a href="javascript:" onClick="del(this, {$vo.id})" class="am-btn am-btn-warning am-btn-xs">驳回</a>
                            {/if}
                        </td>
                    </tr>
                    {/volist}
                    <tr>
                        <th colspan="3"></th>
                        <th>{$sum.withdraw_num}</th>
                        <th>{$sum.fee_num}</th>
                        <th>{$sum.num}</th>
                        <th colspan="5"></th>
                    </tr>
                    </tbody>
                </table>
                <div class="am-pagination-left">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/foot" /}
<script type="text/javascript">
    function pass(obj, id) {
        layer.confirm('确认要通过审核吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: "{:url('index/Apply/modify_withdrawals')}",
                data: {id: id, edit_type: 1},
                dataType: 'json',
                success: function (r) {
                    layer.msg(r.msg);
                    setTimeout(function (){
                        window.location.reload();
                    },1500);
                },
                error: function (r) {
                    layer.msg('审核失败!', {icon: 0, time: 1000});
                },
            });
        });
    }

    function del(obj, id) {
        layer.confirm('确认要驳回吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: "{:url('index/Apply/modify_withdrawals')}",
                data: {id: id, edit_type: 0},
                dataType: 'json',
                success: function (data) {
                    layer.msg('已驳回!', {icon: 1, time: 1000});
                    window.location.href = "{:url('index/Apply/withdraw')}";
                },
                error: function (data) {
                    layer.msg('驳回失败!', {icon: 0, time: 1000});
                },
            });
        });
    }

    $(function () {
        var nav = $('.left-sidebar li.sidebar-nav-link');
        nav.removeClass("active");
        nav.eq({$a}).find('ul').show();
        nav.eq({$a}).find('ul li').eq({$b}).find('a').addClass('active');
    });
</script>
</body>

</html>